package org.example.springboot01.pojo;


import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.example.springboot01.Personalstate.State;
import org.hibernate.validator.constraints.URL;

@Data
public class Article {
    private int id;
    @NotNull(message = "文章标题不能为空")
    @Pattern(regexp = "^\\S{1,10}$")
    private String title;
    @NotNull(message = "文章内容不能为空")
    private String content;
    @URL
    private String cover_img;
    @NotNull(message = "文章状态不能为空")
    @State
    private String state;
    @NotNull(message = "文章分类id不能为空")
    private int category_id;//文章分类id
    @JsonFormat(pattern = "yyyy-MM-dd-HH:mm", timezone = "GMT+8")
    private String create_time;
    @JsonFormat(pattern = "yyyy-MM-dd-HH:mm", timezone = "GMT+8")
    private String update_time;
    private String creater_user;

    public Article() {
    }

    public Article(int id, String title, String content, String cover_img, String state, int category_id, String create_time, String update_time, String creater_user) {
        this.id = id;
        this.title = title;
        this.content = content;
        this.cover_img = cover_img;
        this.state = state;
        this.category_id = category_id;
        this.create_time = create_time;
        this.update_time = update_time;
        this.creater_user = creater_user;
    }
}
